package com.example.spring.service;

import com.example.spring.entity.Slot;
import com.example.spring.mapper.SlotMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SlotService {
    @Autowired
    private SlotMapper slotMapper;

    public int save(Slot slot){
        if(slot.getSid() == null) { //无id新增id
            return slotMapper.insert_data(slot);
        }
        else {//否则更新
            return slotMapper.update(slot);
        }
    }
}
